package com.heather.exam.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.heather.exam.pojo.table.Options;
import com.heather.exam.pojo.table.Question;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface QuestionMapper extends BaseMapper<Question> {
    @Insert("insert into options(question_id,content,is_correct) values(#{questionId},#{content},#{isCorrect})")
    boolean AddOptions(Options options);

    @Insert("insert into question_bank_question(question_id,question_bank_id) values(#{id},#{bankid})")
    boolean AddBank(int id, String bankid);

    @Select("select `before` from question_bank where id=#{questionBankid}")
    int check(String questionBankid);

    @Insert("insert into question_bank_share(question_bank_id,state) values(#{id},1)")
    void addShare(int id);

    @Update("UPDATE question_bank_share set state=#{state} where question_bank_id = #{id}")
    void UpdateShare(int id,int state);
}
